package springcloud.listener;

import com.atguigu.springcloud.event.InnerProtocolMessageEvent;
import com.atguigu.springcloud.message.InnerProtocol;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * @author xiaolong
 * @version 1.0
 * @description: 测试监听任务
 * @date 2021/10/12 15:15
 */
@Component
public class testEventListener {


    @EventListener(InnerProtocolMessageEvent.class)
    public void testEvent(InnerProtocolMessageEvent event) {
        InnerProtocol source = (InnerProtocol) event.getSource();
        String cmd = source.getCmd();
        System.out.println("监听到任务: " + cmd);
    }
}
